package me.caofeng.pojo;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.stream.Stream;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.pojo
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-27 15:09
 * @Version: V1.0
 */
public class Address extends Pojo {

    private String userId;

    @NotNull(message = "收货人不能为空")
    @Size(min = 2, message = "用户名最小要两个字符")
    private String name;

    @NotNull(message = "手机号不能为空")
    @Pattern(regexp = "^((13[0-9])|(14[5|7|9])|(15([0-3]|[5-9]))|(17[0|5|6|7|8|])|(18[0-9]))\\d{8}$",
            message = "手机号格式错误")
    private String phone;

    @NotNull(message = "收获地址不能为空")
    @Size(min = 2, message = "收获地址不能为空")
    private String province;

    @NotNull(message = "收获地址不能为空")
    @Size(min = 2, message = "收获地址不能为空")
    private String city;

    @NotNull(message = "收获地址不能为空")
    @Size(min = 2, message = "收获地址不能为空")
    private String district;

    @NotNull(message = "收获地址不能为空")
    @Size(min = 2, message = "收获地址不能为空")
    private String address;

    public Address() {
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String addressInfo(){
        return name + " " + phone + " " + province + " " + city + " " + district + " " + address;
    }

    @Override
    public String toString() {
        return "Address{" +
                "userId='" + userId + '\'' +
                ", name='" + name + '\'' +
                ", id=" + id +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isDelete=" + isDelete +
                ", phone='" + phone + '\'' +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", district='" + district + '\'' +
                ", address='" + address + '\'' +
                '}';
    }
}
